{% extends "base.html" %}
{% block title %}Sensors{% endblock %}
{% block content %}
    <div class="row">
        <div class="small-4 large-centered columns">
            <h2>Sensors</h2>
        </div>
    </div>
    <div style="max-width: 90.5rem;" class="row">
        <div class="large-12 columns">
            <table style="width:100%" id="sensor-table">
                <thead>
                    <tr>
                        <th></th>
                        <th>Name</th>
                        <th>Hostname</th>
                        <th>IP</th>
                        <th>Honeypot</th>
                        <th>UUID</th>
                        <th>Attacks</th>
                    </tr>
                </thead>
                <tbody>
                    {% for sr in sensors.items %}
                    <tr>
                        <td>{{ pag.skip + loop.index  }}- <img class="del-sensor" data-sensor-id="{{ sr.uuid }}" src="/static/img/trash-24.png"/> </td>
                        <td>
                            <input id="_csrf_token" name="_csrf_token" type="hidden" value="{{ csrf_token() }}">
                            <input data-sensor-id="{{ sr.uuid }}"
                                   type="text"
                                   data-field-name="name"
                                   class="text-edit"
                                   value="{{ sr.name }}"
                            />
                        </td>
                        <td>{{ sr.hostname }}</td>
                        <td>{{ sr.ip}}</td>
                        <td>{{ sr.honeypot}}</td>
                        <td>{{ sr.uuid}}</td>
                        <td><a href="{{ url_for('ui.get_attacks', identifier=sr.uuid) }}">{{ sr.attacks_count }}</a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% from "pagination.html" import render_pagination %}
            {{ render_pagination(sensors, view, request.args.to_dict()) }}
        </div>
    </div>
{% endblock %}
